#include <iostream>

using ull = unsigned long long;
ull n,k;

// #define ONLINE_JUDGE
#ifdef ONLINE_JUDGE
    #define DEBUG(code)
#else
    #define DEBUG(code)code
#endif

int main(){
    std::cin>>n>>k;
    while(1){
        DEBUG(
            std::cout<<'\n'<<n<<", "<<k<<'\n';
        )
        if(n<=1){
            std::cout<<k<<'\n';
            return 0;
        }
        const ull next_num = 1ull<<(n-1);
        if(k>=next_num){
            std::cout<<1;
            k-=next_num;
            k = next_num-k-1;
        }else{
            std::cout<<0;
        }
        --n;
    }
}